//分类页面api文件

import shopAxios from '../utils/request.js'

// 获取商品列表
export async function getAllList() {
    const resp = await shopAxios.get('/category/list');
    return resp;
}

//通过id查询商品
export async function getGood(id) {
    const resp = await shopAxios.get('/category/findById', {
        params: { "id": id }
    })
    return resp;
}

//  添加商品
export async function add(addObj) {
    console.log(addObj);
    const resp = await shopAxios.post('/category/add', addObj)
    return resp;
}

// 删除商品
export async function del(id) {
    const resp = await shopAxios.get('/category/deleteById', {
        params: { "id": id }
    })
    return resp;
}

// 修改商品
export async function update(newObj) {
    console.log(newObj);
    const resp = await shopAxios.post('/category/update', newObj)
    return resp;
}